<template>
  <div v-title data-title="动态航班调度">
    <div class="header">
      <h1>川航 A319 航班调度可视化系统</h1>
    </div>
    <div class="charts">
      <!-- <div class="left"></div> -->
      <div class="mid">
        <div @click="changeMap">
          <div v-if="this.flagMap === true">
            <Map :currentTime="currentTime"></Map>
          </div>
          <div v-else-if="this.flagMap === false">
            <Mapa></Mapa>
          </div>
        </div>
      </div>

      <div class="right">
          <div v-if="this.flagMap === true">
            <ctrl @changeTime="changeTime"></ctrl>
            <ProgressBar :currentTime="currentTime"  style="margin-top:10px"></ProgressBar>
          </div>

          <div v-else-if="this.flagMap === false">
            <div @click="qiehuan2">
              <div v-if="this.flag2 === true"><pie4></pie4></div>
              <div v-else-if="this.flag2 === false"><pie></pie></div>
            </div>
            <div @click="qiehuan" style="margin-top:10px">
              <div v-if="this.flag === true"><pie2></pie2></div>
              <div v-else-if="this.flag === false"><pie3></pie3></div>
            </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import ECharts from "@/components/ECharts";
import Map from "@/components/Map";
import Mapa from "@/components/Map-a";
import ProgressBar from "@/components/ProgressBar";
// import ProgressBara from "@/components/ProgressBar-a";
// import Bar from "@/components/Bar";
import Pie from "@/components/Pie";
import Pie4 from "@/components/Pie4";
import Pie2 from "@/components/Pie2";
import Pie3 from "@/components/Pie3";
import Ctrl from "@/components/Ctrl";

export default {
  name: "航班调度算法可视化系统",
  data: function () {
    return {
      nowTime: "",
      flag: false,
      flagMap: false,
      flag2: false,
      currentTime: 0,
    };
  },
  components: {
    ECharts,
    Map,
    Mapa,
    ProgressBar,
    // ProgressBara,
    // Bar,
    Pie,
    Pie2,
    Pie3,
    Ctrl,
    Pie4,
  },
  // created() {
  //   // 引入机场节点。注意！可能该节点不在地图内
  //   const AirlinesJson = require('./static/json/Airlines_A319');
  //   setInterval(() => {
  //     this.currentTime ++;
  //     if(this.currentTime >= AirlinesJson.length)
  //       this.currentTime = 0;
  //   }, 3000)  //更新
  // },
  methods: {
    qiehuan() {
      this.flag = !this.flag;
    },
    qiehuan2() {
      this.flag2 = !this.flag2;
    },
    changeMap() {
      this.flagMap = !this.flagMap;
    },
    changeTime(currentTime) {
      this.currentTime = currentTime;
    },
  },
};
</script>

<style>
/* 实现响应式 */
html {
  /* 将屏幕的宽度设置为24rem,从而自动实现将内容按照屏幕的大小进行缩放 */
  /* 屏幕宽高比16:9 */
  font-size: calc(100vw / 24);
  color: #fff;
}

/* 声明字体 */
@font-face {
  font-family: electronicFont;
  src: url(./assets/DS-DIGIT.TTF);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

body {
  width: 100vw;
  height: calc(100vw / 16 * 9);
  font-size: 12px;
  background-image: url(assets/bg.jpg);
  background-size: cover;
  background-repeat: no-repeat;
}

#app {
  width: 100vw;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.header {
  width: 100vw;
  text-align: center;
  position: relative;
  height: 1.25rem;
  line-height: 1.25rem;
  background-image: url(assets/head_bg.png);
  background-size: 100%;
  background-repeat: no-repeat;
}

.header h1 {
  width: 100%;
  font-size: 0.6rem;
  line-height: 1.25rem;
}

.header .showtime {
  position: absolute;
  right: 0.5rem;
  top: 20%;
  height: 0.5rem;
  line-height: 0.5rem;
  /* margin-top: 0.25rem; */
  font-size: 0.25rem;
}

.charts {
  flex: 0;
  width: 100vw;
  padding: 0.15rem;
  display: flex;
}

.charts .left {
  flex: 8.5;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
}
.charts .mid {
  flex: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
}
.charts .right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
}

.mid .title {
  margin: 0.1rem 0.1rem 2rem 0.1rem;
  padding: 0.2rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.2);
}

.mid .title .number {
  width: 100%;
  height: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: #f5d0a9;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.borderTop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0.1rem;
}

.borderTop::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0.4rem;
  height: 0.2rem;
  border-left: 2px solid skyblue;
  border-top: 2px solid skyblue;
}

.borderbottom {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 0.1rem;
}
.borderbottom::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0.4rem;
  height: 0.2rem;
  border-bottom: 2px solid skyblue;
  border-right: 2px solid skyblue;
}

.mid .title .number span:nth-of-type(1) {
  width: 50%;
  text-align: center;
}

.mid .title .number span:nth-of-type(3) {
  width: 50%;
  text-align: center;
}

.mid .title .number span:nth-of-type(2) {
  height: 0.6rem;
  line-height: 1.4rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.mid .title .desc {
  width: 100%;
  height: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
  color: rgba(255, 255, 255, 0.8);
}

.mid .title .desc span:nth-child(1) {
  width: 50%;
  text-align: center;
}

.mid .title .desc span:nth-child(2) {
  width: 50%;
  text-align: center;
}
</style>
